package com.spyx.product.service.impl;


import com.atyx.spyx.model.product.Attr;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.spyx.product.mapper.AttrMapper;
import com.spyx.product.service.AttrService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;

/**
 * <p>
 * 商品属性 服务实现类
 * </p>
 *
 * @author yhp
 * @since 2024-05-15
 */
@Service
public class AttrServiceImpl extends ServiceImpl<AttrMapper, Attr> implements AttrService {
    @Override
    public List<Attr> getAttrList(Integer groupid) {
        //1.写条件
        LambdaQueryWrapper<Attr> wrapper = new LambdaQueryWrapper<>();
        if(!StringUtils.isEmpty(groupid)){
            wrapper.eq(Attr::getAttrGroupId,groupid);
        }
        //2.执行查询
        List<Attr> attrList = baseMapper.selectList(wrapper);
        return attrList;
    }
}
